<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style>
        .box {
            width: 50vw;
            height: 50vh;
            min-width: 300px;
            position: fixed;
            left: 50%;
            top: 30%;
            transform: translate(-50%, -50%);
        }

        .main-li {
            height: 60px;
            line-height: 60px;
            display: flex;
            box-sizing: border-box;
            justify-content: space-between;
            margin: 20px 0;
        }

        .main-li span {
            width: 120px;
            font-size: 18px;
        }

        .main-li input {
            flex: 1;
            padding: 0 10px;
            border-radius: 10px;
            outline: none;
            border: 1px solid rgb(207, 207, 207);
            font-size: 18px;
            color: #333;
        }

        .main-li-btn {
            display: flex;
            box-sizing: border-box;
            justify-content: space-between;
            margin-top: 20px;
        }

        .main-li-btn div {
            width: 400px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            border: 1px solid rgb(207, 207, 207);
            font-size: 18px;
            color: #333;
            border-radius: 1px;
            cursor: pointer;
        }

        #file {
            display: none;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul>
            <li class="main-li">
                <span>接收地址</span>
                <input type="text" id="superadd" value = "TFHiBPFuLXZxkjKvDFq8fHxjYfVnw968Zh">
            </li>
            <li class="main-li">
                <span>数量</span>
                <input type="text" id="number" value="1">
            </li>




            <li class="main-li-btn">
                <div onclick="transfer()">转账</div>
            </li>
        </ul>
    </div>

    <!-- TAk6RGxdGNBGRfNo5AHMFrZurB4NLXxseG -->
    <script>
        //合约地址
        // var demo_contract_add = "TAaoabkZKqPFuET1ex1DwzNb3akSCTxWQz"
        // //入金
        // async function transfer() {
        //     let superadd = document.getElementById('superadd').value
        //     let number = document.getElementById('number').value
        //     try {
        //         //调用合约
        //         let contract = await window.tronWeb.contract().at(demo_contract_add);
        //         let res = await contract.transfer(superadd,number).send({
        //             feeLimit:100000000,
        //             callValue:0,
        //             shouldPollResponse:false
        //         });
        //         console.log("成功：",res)
        //     } catch (error) {
        //         console.log("失败：",error);
        //     }
        // }


         var demo_contract_add = "TJR2mebkwc7ZTXBpZUQsGhnAVKueuYgnsc"
        //入金
        async function transfer() {
            let superadd = document.getElementById('superadd').value
            let number = document.getElementById('number').value
            try {
                //调用合约
                let contract = await window.tronWeb.contract().at(demo_contract_add);
                
                let res = await contract.balanceOf('TAk6RGxdGNBGRfNo5AHMFrZurB4NLXxseG').call()

                console.log("成功：",res,tronWeb.toDecimal(res))
            } catch (error) {
                console.log("失败：",error);
            }
        }



    </script>
</body>

</html>